package com.example.springboottest.studentscore.service.impl;

import com.example.springboottest.studentscore.model.StuScore;
import com.example.springboottest.studentscore.service.StuScoreService;
import com.example.springboottest.util.IdUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class StuScoreServiceImpl implements StuScoreService {
    @Autowired
    private JdbcTemplate jdbcTemplate;

    @Override
    public void doDeleteByStuId(String stuId) {
        jdbcTemplate.update("delete from student_score where stu_id = ?", stuId);
    }

    @Override
    public void doCreate(StuScore stuScore) {
        jdbcTemplate.update("insert into student_score values(?,?,?,?)", IdUtil.getUUID(), stuScore.getStuId(), stuScore.getSubId(), stuScore.getScore());
    }
}
